home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_03_05
/
3n05068a
< prev
next >
Wrap
Text File
|
1992-03-16
|
801b
|
34 lines
/*
* daytime.c - a demonstration program to read and
* interpret the DOS CLOCK$ driver
* Written by M. L. Lesser, 11/7/91, for Borland C
* (Use pragma to pack structures
* if compiling with MS C)
*/
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
int handle;
typedef unsigned char byte;
struct {
int days;
byte minutes;
byte hours;
byte hundsecs;
byte seconds;
} today;
void main()
{
handle = open("CLOCK$",O_RDONLY | O_BINARY);
read(handle,&today,6);
close(handle);
printf("There have been %d days since 1-1-80\n",today.days);
printf("The time of day is %02d:%02d:%02d.%02d\n",
today.hours,today.minutes,today.seconds,today.hundsecs);
}